// Author: wsfuyibing <682805@qq.com>
// Date: 2025-07-01

package pre

import (
	"server/app/http/models"
	"server/app/http/responses"
	"server/app/lib/order/operations"
)

// Response
// 出参.
type Response struct {
	Prepay *operations.Prepay
	Items  []*responses.OrderItemResponse
}

func (o *Response) WithItem(item *models.OrderItem) *Response {
	if o.Items == nil {
		o.Items = []*responses.OrderItemResponse{}
	}
	o.Items = append(o.Items, (&responses.OrderItemResponse{}).With(item))
	return o
}

func (o *Response) WithItems(items []*models.OrderItem) *Response {
	for _, item := range items {
		o.WithItem(item)
	}
	return o
}
